function Animal(name) {
    this.name = name;
}
Animal.prototype.sayHello = function() {
    console.log("我是" + this.name);
};
function Dog(name) {
    // 调用基类构造函数初始化属性
    Animal.call(this, name);
}
// 将Dog的原型指向Animal的实例
Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.bark = function() {
    console.log("汪汪！");
};
var dog = new Dog("小黄");
dog.sayHello();   // 输出 "我是小黄"
dog.bark();       // 输出 "汪汪！"